//
//  CZUser.swift
//  sinaWeiboswift
//
//  Created by 段文杰 on 16/4/14.
//  Copyright © 2016年 段文杰. All rights reserved.
//

import UIKit

class CZUser: NSObject {

    /// 用户UID
    var id: Int64 = 0
    
    /// 用户昵称
    var screen_name: String?
    
    /// 用户头像地址（中图,50×50像素
    var profile_image_url: String?
    
    /// verified_type 没有认证:-1   认证用户:0  企业认证:2,3,5  达人:220
    var verified_type: Int = -1 {
    
        didSet{
        
            switch verified_type  {
            case 0:
                verifieldImage = UIImage.init(named: "avatar_vip")
            case 2,3,5:
                verifieldImage = UIImage.init(named: "avatar_enterprise_vip")
            case 220:
                verifieldImage = UIImage.init(named: "avatar_grassroot")
            default:
                verifieldImage = nil
            }
        
        }
    
    
    
    }
    
    var verifieldImage : UIImage?
    var mbrankImage : UIImage?
    
    
    /// 会员等级: 1-6级
    var mbrank: Int = 0 {
        didSet{
        
        
            switch mbrank {
            case 1:
                mbrankImage = UIImage.init(named: "common_icon_membership_level1")
            case 2:
                mbrankImage = UIImage.init(named: "common_icon_membership_level2")
            case 3:
                mbrankImage = UIImage.init(named: "common_icon_membership_level3")
            case 4:
                mbrankImage = UIImage.init(named: "common_icon_membership_level4")
            case 5:
                mbrankImage = UIImage.init(named: "common_icon_membership_level5")
            case 6:
                mbrankImage = UIImage.init(named: "common_icon_membership_level6")
    
            default:
                mbrankImage = nil
            }
        
        }
    
    
    
    }
    
    init(dict: [String: AnyObject]) {
        super.init()
        
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
    /// 对象输出
    override var description: String {
        // 只读计算型属性
        let keys = ["id", "profile_image_url", "screen_name", "mbrank", "verified_type"]
        
//        return "\n\t: \(dictionaryWithValuesForKeys(keys).description)"
        return self.dictionaryWithValuesForKeys(keys).description
    }

    
    
    
    
    
    
    
    
    
    
    
    
    
    
}
